package com.example.dml.observer_pattern.test;

import java.util.Observable;
import java.util.Observer;

/**
 * @Authors：gaoyang
 * @CreateTime：2021/11/2 22:49
 * @Description：todo
 */
public class Teacher implements Observer {

    private String name;

    public Teacher(String name) {
        this.name = name;
    }

    @Override
    public void update(Observable o, Object arg) {
        Gper gper = (Gper) o;
        Question question = (Question) arg;
        System.out.println("====================");
        System.out.println(name+"老师，你好！\n"+
                "您收到一个来及（"+gper.getName()+")的提问，希望您解答，问题内容如下\n"+
                question.getContent()+"\n"+
                "提问者:"+question.getUserName());
    }
}
